
<style>
	.appmsg{position: relative;border:0 none; border-bottom: 1px solid #e7e7eb;}
	.item-status{position:absolute;right:3px;top:0;font-size: 12px;}
	#maincontent{margin-bottom: 50px;padding:10px 0;}
	.appmsg_content { display:flex;padding: 10px;}
	.appmsg_content .coverimg{flex:0 0 30%;}
	.appmsg_content .check{flex:0 0 10%;margin-top: 30px;}
	.appmsg_content .des{flex:0 0 60%;font-size:14px;padding-left:5px;}
	.appmsg_content .des .title{color:#333;font-size:16px;}
	.appmsg .cover{margin: 0 2px;padding-top:100%;height:0;background-size:cover; background-position: center;background-repeat: no-repeat;}
</style>

<form id="WxActivityForm" name="WxActivityForm" method="post" action="/products/addActivity">
	<input type="hidden" name="gid" value="{{$group['MiscCate']['id']}}">
       <div class="ui-portlet" style="margin-top:10px;">
	       <div class="clearfix ui-portlet-list" id="storefront-list">
	       {{loop $products $p}}
	       		<div class="appmsg">
		       		<div class="appmsg_content">
						<div class="check"><input name="pids[]" class="checkProduct" type="checkbox" value="{{$p['Product']['id']}}"></div>
						<div class="coverimg">
						<a href="{{$this->Html->url('/products/view/'.$p['Product']['id'])}}" target="_blank">
							<div class="cover" style="background-image:url({{$p['Product']['coverimg']}})"></div>
						</a>
						</div>
						<div class="des">
							<p><a class="title" href="{{$this->Html->url('/products/view/'.$p['Product']['id'])}}" target="_blank">{{usubstr($p['Product']['name'],0,24,'...')}}</a></p>
							<p><span class="product-price">{{format_price($p['Product']['price'])}}</span></p>
						</div>
		       		</div>
	       		</div>
	  		{{/loop}}
	    	</div>
	    	<div>{{$page_navi}}</div>
    	</div>
</form>


		<div id="cart1" class="cart-concern-btm-fixed" {{if !$is_mobile}}style="position: initial;"{{/if}}>
			<div class="concern-cart">
				<a href="/wx_activities/lists?model=Baoming&status=1&creator={{$current_user_id}}" class="dong-dong-icn J_ping">
					<i class="fa fa-home"></i>
					<span class="focus-info">首页</span>
				</a>
				<a href="/users/index" class="love-heart-icn J_ping" >
					<i class="fa fa-user"></i>
					<span class="focus-info"> 我的  </span>
				</a>

			</div>
			<div class="action-list">
				<a href="javascript:;" onclick="AddWxActivity();" class="red-color baoming-btn directorder" id="directorderBtm">
					分享选中商品
				</a>
			</div>
		</div>
<script>
    function AddWxActivity(){
        var total = 0;
        if( $('.checkProduct:checked').length <1 ){
            alert('没有选中分销的商品');
        }
        else{
            var form = document.getElementById('WxActivityForm');
            ajaxSubmitForm(form,function(request){
                if(request.ret ==0 ) {
                    showSuccessMessage(request.msg);
					window.location = "/wx_activities/view/"+request.data.id;
                }
                else{
                    showErrorMessage(request.msg);
                }
            });
        }

        return false;
    }

</script>